class Solution {
public:
    int firstUniqChar(string s) {
        int cout[26] = { 0 };
        for (auto ch : s) {
            cout[ch - 'a']++;
        }
        for (int i = 0; i < s.size(); i++) {
            if (cout[s[i] - 'a'] == 1) {
                return i;
            }
        }
        return -1;

    }
};